package progma.utils;

import java.util.Collection;

public class StringUtils {

	private StringUtils() {}
	
	public static String join(Collection<?> coll, String separator) {
		if(coll == null || coll.isEmpty())
			return "";
		if(coll.size() == 1)
			return coll.iterator().next().toString();
		
		StringBuilder builder = new StringBuilder();
		boolean first = true;
		for(Object s : coll) {
			if(!first)
				builder.append(separator);
			builder.append(s);
			first = false;
		}
		return builder.toString();
	}
}
